package com.internetCafes.spms.web.certificate.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.internetCafes.spms.common.CommonConstants;
import com.sms.common.util.hutool.core.util.IdcardUtil;
import com.sms.common.util.hutool.core.util.ObjectUtil;

import java.io.Serializable;
import java.util.Date;


/**
 * 员工信息表
 *
 * @author Sunny
 * @email rekeeper2011@hotmail.com
 * @date 2019-12-04 10:38:25
 */
public class EmployeeInfo implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 基础信息ID
     */
    private Long id;

    /**
     * 类型 1：个人 2：企业 3：机构
     * 版本二：证书类型 保存的时候 1在职员工,2挂靠,3非在职员工
     */
    private Integer type;

    /**
     * 租户id
     */
    private Long tenantId;

    /**
     * 部门id
     */
    private Long deptId;

    /**
     * 姓名
     */
    private String name;

    /**
     * 身份证号
     */
    private String idCard;

    /**
     * 性别 0:未知 1:男 2:女
     */
    private Integer gender;

    /**
     * 年龄
     */
    private Integer age;

    /**
     * 手机号码
     */
    private String mobile;

    /**
     * 学历
     */
    private String academic;

    /**
     * 工作年限
     */
    private Integer workYears;

    /**
     * 毕业学校
     */
    private String schoolName;

    /**
     * 所学专业
     */
    private String schoolProfession;

    /**
     * 是否已婚
     */
    private Integer marriageFlag;

    /**
     * 毕业时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date graduateTime;

    /**
     * 职称
     */
    private String jobGrade;

    /**
     * 工作单位
     */
    private String workUnit;

    /**
     * 工作单位地址
     */
    private String workUnitAddress;

    /**
     * 邮政编码
     */
    private String zipCode;

    /**
     * 考生来源:1：个人 2：企业 3：机构
     */
    private Integer candidatesSource;

    /**
     * 机构名称
     */
    private String orgName;

    /**
     * 机构联系电话
     */
    private String orgContactMobile;

    /**
     * 机构联系人
     */
    private String orgContact;

    /**
     * 企业名称
     */
    private String companyName;

    /**
     * 企业联系人
     */
    private String companyContact;

    /**
     * 企业联系电话
     */
    private String companyContactMobile;

    /**
     * 入职时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date entryTime;

    /**
     * 合同到期时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date contractExpirationTime;

    /**
     * 备注
     */
    private String remark;

    /**
     * 头像
     */
    private String avatarPic;

    /**
     * 更新状态
     */
    private Integer status;

    /**
     * 创建人
     */
    private Long createBy;

    /**
     * 创建时间
     */

    private Date createTime;

    /**
     * 更新者
     */
    private Long updateBy;

    /**
     * 更新时间
     */
    private Date updateTime;

    /**
     * 职位
     */
    private String post;

    /**
     * 是否在职:1在职，0离职
     */
    private Integer onCompanyFlag;

    /**
     * 离职时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date companyEndTime;

    /**
     * 是否为手动录入员工
     */
    private Integer employeeFlag;

    /**
     * 是否交社保,1是,0否
     */
    private Integer socialSecurityFlag;

    /**
     * 参保时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date socialSecurityTime;

    /**
     * 是否是技术负责人
     */
    private Integer directorFlag;

    /**
     * 负责内容
     */
    private String directorFor;

    /**
     * 所在部门名称
     */
    private String deptName;

    public String getDeptName() {
        return deptName;
    }

    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }

    public Integer getSocialSecurityFlag() {
        return socialSecurityFlag;
    }

    public void setSocialSecurityFlag(Integer socialSecurityFlag) {
        this.socialSecurityFlag = socialSecurityFlag;
    }

    public Date getSocialSecurityTime() {
        return socialSecurityTime;
    }

    public void setSocialSecurityTime(Date socialSecurityTime) {
        this.socialSecurityTime = socialSecurityTime;
    }

    public Integer getDirectorFlag() {
        return directorFlag;
    }

    public void setDirectorFlag(Integer directorFlag) {
        this.directorFlag = directorFlag;
    }

    public String getDirectorFor() {
        return directorFor;
    }

    public void setDirectorFor(String directorFor) {
        this.directorFor = directorFor;
    }

    public Integer getEmployeeFlag() {
        return employeeFlag;
    }

    public void setEmployeeFlag(Integer employeeFlag) {
        this.employeeFlag = employeeFlag;
    }

    public Integer getOnCompanyFlag() {
        if (onCompanyFlag == null) {
            return CommonConstants.CommonStatus.ENABLE;
        }
        return onCompanyFlag;
    }

    public void setOnCompanyFlag(Integer onCompanyFlag) {
        this.onCompanyFlag = onCompanyFlag;
    }

    public Date getCompanyEndTime() {
        return companyEndTime;
    }

    public void setCompanyEndTime(Date companyEndTime) {
        this.companyEndTime = companyEndTime;
    }

    public String getPost() {
        return post;
    }

    public void setPost(String post) {
        this.post = post;
    }

    public EmployeeInfo() {
    }

    public EmployeeInfo(Integer type, Long tenantId, Long deptId, String name, String mobile) {
        this.type = type;
        this.tenantId = tenantId;
        this.deptId = deptId;
        this.name = name;
        this.mobile = mobile;
        this.status = CommonConstants.CommonStatus.ENABLE;
        this.createTime = new Date();
    }

    @JSONField(name = "id")
    public void setId(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    @JSONField(name = "type")
    public void setType(Integer type) {
        this.type = type;
    }

    public Integer getType() {
        return type;
    }

    @JSONField(name = "tenant_id")
    public void setTenantId(Long tenantId) {
        this.tenantId = tenantId;
    }

    public Long getTenantId() {
        return tenantId;
    }

    @JSONField(name = "dept_id")
    public void setDeptId(Long deptId) {
        this.deptId = deptId;
    }

    public Long getDeptId() {
        return deptId;
    }

    @JSONField(name = "name")
    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    @JSONField(name = "id_card")
    public void setIdCard(String idCard) {
        this.idCard = idCard;
    }

    public String getIdCard() {
        return idCard;
    }

    @JSONField(name = "gender")
    public void setGender(Integer gender) {
        this.gender = gender;
    }

    public Integer getGender() {
        if (idCard != null && !"".equals(idCard.trim())) {
            return IdcardUtil.getGenderByIdCard(idCard);
        }
        return ObjectUtil.isNull(gender) ? 0 : gender;
    }

    @JSONField(name = "mobile")
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getMobile() {
        return mobile;
    }

    @JSONField(name = "academic")
    public void setAcademic(String academic) {
        this.academic = academic;
    }

    public String getAcademic() {
        return academic;
    }

    @JSONField(name = "work_years")
    public void setWorkYears(Integer workYears) {
        this.workYears = workYears;
    }

    public Integer getWorkYears() {
        return workYears;
    }

    @JSONField(name = "school_name")
    public void setSchoolName(String schoolName) {
        this.schoolName = schoolName;
    }

    public String getSchoolName() {
        return schoolName;
    }

    @JSONField(name = "school_profession")
    public void setSchoolProfession(String schoolProfession) {
        this.schoolProfession = schoolProfession;
    }

    public String getSchoolProfession() {
        return schoolProfession;
    }

    @JSONField(name = "graduate_time")
    public void setGraduateTime(Date graduateTime) {
        this.graduateTime = graduateTime;
    }

    public Date getGraduateTime() {
        return graduateTime;
    }

    @JSONField(name = "job_grade")
    public void setJobGrade(String jobGrade) {
        this.jobGrade = jobGrade;
    }

    public String getJobGrade() {
        return jobGrade;
    }

    @JSONField(name = "work_unit")
    public void setWorkUnit(String workUnit) {
        this.workUnit = workUnit;
    }

    public String getWorkUnit() {
        return workUnit;
    }

    @JSONField(name = "work_unit_address")
    public void setWorkUnitAddress(String workUnitAddress) {
        this.workUnitAddress = workUnitAddress;
    }

    public String getWorkUnitAddress() {
        return workUnitAddress;
    }

    @JSONField(name = "zip_code")
    public void setZipCode(String zipCode) {
        this.zipCode = zipCode;
    }

    public String getZipCode() {
        return zipCode;
    }

    @JSONField(name = "candidates_source")
    public void setCandidatesSource(Integer candidatesSource) {
        this.candidatesSource = candidatesSource;
    }

    public Integer getCandidatesSource() {
        return candidatesSource;
    }

    @JSONField(name = "org_name")
    public void setOrgName(String orgName) {
        this.orgName = orgName;
    }

    public String getOrgName() {
        return orgName;
    }

    @JSONField(name = "org_contact_mobile")
    public void setOrgContactMobile(String orgContactMobile) {
        this.orgContactMobile = orgContactMobile;
    }

    public String getOrgContactMobile() {
        return orgContactMobile;
    }

    @JSONField(name = "org_contact")
    public void setOrgContact(String orgContact) {
        this.orgContact = orgContact;
    }

    public String getOrgContact() {
        return orgContact;
    }

    @JSONField(name = "company_name")
    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }

    public String getCompanyName() {
        return companyName;
    }

    @JSONField(name = "company_contact")
    public void setCompanyContact(String companyContact) {
        this.companyContact = companyContact;
    }

    public String getCompanyContact() {
        return companyContact;
    }

    @JSONField(name = "company_contact_mobile")
    public void setCompanyContactMobile(String companyContactMobile) {
        this.companyContactMobile = companyContactMobile;
    }

    public String getCompanyContactMobile() {
        return companyContactMobile;
    }

    @JSONField(name = "entry_time")
    public void setEntryTime(Date entryTime) {
        this.entryTime = entryTime;
    }

    public Date getEntryTime() {
        return entryTime;
    }

    @JSONField(name = "contract_expiration_time")
    public void setContractExpirationTime(Date contractExpirationTime) {
        this.contractExpirationTime = contractExpirationTime;
    }

    public Date getContractExpirationTime() {
        return contractExpirationTime;
    }

    @JSONField(name = "remark")
    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getRemark() {
        return remark;
    }

    @JSONField(name = "avatar_pic")
    public void setAvatarPic(String avatarPic) {
        this.avatarPic = avatarPic;
    }

    public String getAvatarPic() {
        return avatarPic;
    }

    @JSONField(name = "status")
    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getStatus() {
        return status;
    }

    @JSONField(name = "create_by")
    public void setCreateBy(Long createBy) {
        this.createBy = createBy;
    }

    public Long getCreateBy() {
        return createBy;
    }

    @JSONField(name = "create_time")
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getCreateTime() {
        return createTime;
    }

    @JSONField(name = "update_by")
    public void setUpdateBy(Long updateBy) {
        this.updateBy = updateBy;
    }

    public Long getUpdateBy() {
        return updateBy;
    }

    @JSONField(name = "update_time")
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public Integer getMarriageFlag() {
        return marriageFlag;
    }

    @JSONField(name = "marriage_flag")
    public void setMarriageFlag(Integer marriageFlag) {
        this.marriageFlag = marriageFlag;
    }

    public Integer getAge() {
        if (age == null && idCard != null && !"".equals(idCard)) {
            return IdcardUtil.getAgeByIdCard(idCard);
        }
        return age;
    }

    @JSONField(name = "age")
    public void setAge(Integer age) {
        this.age = age;
    }
}
